package cn.iocoder.yudao.module.dr.dal.mysql.sourceapplydetail;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.dr.controller.admin.sourceapplydetail.vo.SourceApplyDetailPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.sourceapplydetail.SourceApplyDetailDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 资源申请详情 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SourceApplyDetailMapper extends BaseMapperX<SourceApplyDetailDO> {

    default PageResult<SourceApplyDetailDO> selectPage(SourceApplyDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SourceApplyDetailDO>()
                .eqIfPresent(SourceApplyDetailDO::getSourceId, reqVO.getSourceId())
                .betweenIfPresent(SourceApplyDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SourceApplyDetailDO::getId));
    }

    default void deleteByApplyId(Long applyId){
        delete(SourceApplyDetailDO::getApplyId,applyId);
    };

    default List<SourceApplyDetailDO> getSourceApplyDetailList(Long applyId){
        return selectList(SourceApplyDetailDO::getApplyId,applyId);
    };
}